/****************************************************************
 * <strong>MFServletContext</strong>
 *
 * <p>
 * MFServletContext
 * </p>
 *
 * @author AndyZhang 2011
 * @version 0.1
 * ToDo:2011-12-30
 ***************************************************************/

package com.thinkwide.data.servlet;

import com.thinkwide.data.filter.MFXFilter;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.io.PrintWriter;


public class MFServletContext {

    public static HttpServletRequest getRequest() {
        HttpServletRequest request = MFXFilter.threadRequestLocal.get();
        return request;
    }

    public static HttpSession getSession() {
        HttpServletRequest request = MFXFilter.threadRequestLocal.get();
        return request.getSession();
    }

    public static PrintWriter getOut() throws IOException {
        return MFServletContext.getResponse().getWriter();
    }

    public static HttpServletResponse getResponse() {
        HttpServletResponse response = MFXFilter.threadResponseLocal.get();
        return response;
    }

}
